<?php
/**
 * Created by PhpStorm.
 * User: SnGef
 * Date: 2017/6/27
 * Time: 16:49
 */
global $_W, $_GPC;
//提交保存
$isAdd=$_GPC["isAdd"];
if ($_GPC['submit'] ) {
    $deviceinfo = $_GPC["deviceInfo"];
    if ($isAdd=='1'){
        $result = pdo_insert('xd_device', $deviceinfo);
        if(!empty($result)) {
            $device_id = pdo_insertid();
            message('提交成功', $this->createWebUrl('device'), 'success');
        }else{
            message('提交失败', $this->createWebUrl('device'), 'warning');
        }
    }else
    {
//        print_r($deviceinfo)."<br/>";
//        echo $deviceinfo["id"];
//        exit;
        $result = pdo_update('xd_device', $deviceinfo, array("id" =>$deviceinfo["id"]));

        if(!empty($result)){
            message('提交成功', $this->createWebUrl('device'), 'success');
        }else{
            message('提交失败', $this->createWebUrl('device'), 'warning');
        }
    }
}

